/*
	Tester class for Part5.

	This class creates some shapes, adds them to a ShapeList,
	then calls the recursive oneShapePrintReverse method
	on each type of shape in the list.


*/
public class Part5Tester
{
	private static int MAX_SHAPES = 5;

	public static void main(String [] args)
	{
		Shape [] shapes = new Shape[MAX_SHAPES];
		int i;

		shapes[0] = new Square(4);
		shapes[1] = new Circle(1);
		shapes[2] = new Square(8);
		shapes[3] = new Circle(2);
		shapes[4] = new Square(3);


		ShapeList list = new ShapeList();

		System.out.println( "Call routine on empty list..." );
		list.oneShapePrintReverse( "Circle" );


		//add some shapes to list
		for (i = 0; i < shapes.length; i++)
			list.addLast( shapes[i] );

		System.out.println( "\nHere are the shapes after adding in order..." );
		System.out.println( list );

		//print the Circles in reverse
		System.out.println( "\nPrinting Circles in reverse..." );
		list.oneShapePrintReverse( "Circle" );

		//now print the Squares
		System.out.println( "\nPrinting Squares in reverse..." );
		list.oneShapePrintReverse( "Square" );

		list = new ShapeList();
		list.addLast( new Square(99) ); // a list with just a square in it
		System.out.println( "\nPrinting a list with one square in it in reverse..." );
		list.oneShapePrintReverse( "Square" );

		System.out.println( "\nPrinting Circles in reverse -- when no circles are in list" );
		System.out.println( "--there should not be any output following this statement..." );
		list.oneShapePrintReverse( "Circle" );



	}//end main method

}//end class Part5Tester